//
//  ArtistnameTableViewCell.m
//  DolphinMusic
//
//  Created by dlios on 15-3-27.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "ArtistnameTableViewCell.h"
#import "UIImageView+WebCache.h"

@implementation ArtistnameTableViewCell
- (void)dealloc
{
    [_coverImage release];
    [_nameLabel release];
    [_singer release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.nameLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.nameLabel];
        [_nameLabel release];
        
        self.coverImage = [[UIImageView alloc] init];
        [self.contentView addSubview:self.coverImage];
        [_coverImage release];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    CGFloat width = self.contentView.frame.size.width;
    CGFloat height = self.contentView.frame.size.height;
    
    self.coverImage.frame = CGRectMake(15, 5, height - 10, height - 10);
    [self.coverImage setImageWithURL:[NSURL URLWithString:[self.singer.avatar_middle stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
    
    self.nameLabel.frame = CGRectMake(height + 15, 0, width - height - 15  - 10, height);
    self.nameLabel.text = self.singer.name;
    self.nameLabel.font = [UIFont systemFontOfSize:16];
    self.nameLabel.numberOfLines = 0;
    
    
}




- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
